﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using strange.extensions.context.impl;
using strange.extensions.context.api;

public class GameContext : MVCSContext {

    public GameContext(MonoBehaviour view, bool autoMapping) : base(view, autoMapping)
	{
    }
    /// <summary>
    /// 绑定映射
    /// </summary>
    protected override void mapBindings()
    {
        //绑定model 就可以在所有的command中访问
        injectionBinder.Bind<IntegrationModel>().To<IntegrationModel>().ToSingleton();
        injectionBinder.Bind<CardModel>().To<CardModel>().ToSingleton();
        injectionBinder.Bind<RoundModel>().To<RoundModel>().ToSingleton();
        //绑定View到Mediator
        mediationBinder.Bind<StartView>().To<StartMediator>();
        mediationBinder.Bind<IntergrationView>().To<IntergrationMediator>();
        mediationBinder.Bind<CharacterView>().To<CharacterMediator>();
        //mediationBinder.Bind<GameOverView>().To<IntergrationMediator>();
        //将事件和命令绑定在一起
        commandBinder.Bind(CommandEvent.Command_ChangeMultiple).To<ChangeMutiplyCommand>();
        commandBinder.Bind(CommandEvent.Command_RegisterDeal).To<DealCommand>();
        commandBinder.Bind(CommandEvent.Command_Grab).To<GrabCommand>();
        commandBinder.Bind(CommandEvent.Command_PlayCard).To<PlayCardCommand>();
        commandBinder.Bind(CommandEvent.Command_Pass).To<PassCommand>();
        commandBinder.Bind(CommandEvent.Command_Successed).To<GameSuccessedCommand>();
        commandBinder.Bind(CommandEvent.Command_UpdataIntegration).To<UpdataItegrationCommand>();
        //绑定开始命令 并且只执行一次
        commandBinder.Bind(ContextEvent.START).To<StartCommand>().Once();
    }
}
